/*
 * Created by SharpDevelop.
 * User: CarnsD
 * Date: 12/28/2007
 * Time: 9:16 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Rss;

namespace RssPull
{
	/// <summary>
	/// Description of PullFeed.
	/// </summary>
	public class PullFeed
	{
		public string url;

		public PullFeed (string url)
		{
			this.url = url;
		}

		public void getFeed()
		{
			try
			{
				RssFeed feed = RssFeed.Read(url);
				
				int channelcount = feed.Channels.Count;
				for (int i = 0; i < channelcount; i++)
				{
					Console.WriteLine("\n" + feed.Channels[i].Title);
					
					RssChannel channel = (RssChannel)feed.Channels[i];
					int itemcount = feed.Channels[i].Items.Count;
					
					for ( int i2 = 0; i2 < itemcount; i2++ )
					{
						Console.WriteLine("\t" + channel.Items[i2].Title);
						
					}
				}
				
			}
			catch (Exception e)
			{
				Console.WriteLine("The error is " + e.Message);
			}
		}
	}
}
